home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-MIPS / JAZZ.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  9KB  |  318 lines

  1. /* $Id: jazz.h,v 1.8 1998/09/16 22:52:41 ralf Exp $
  2.  *
  3.  * This file is subject to the terms and conditions of the GNU General Public
  4.  * License.  See the file "COPYING" in the main directory of this archive
  5.  * for more details.
  6.  *
  7.  * Copyright (C) 1995 - 1998 by Andreas Busse and Ralf Baechle
  8.  */
  9. #ifndef __ASM_MIPS_JAZZ_H 
  10. #define __ASM_MIPS_JAZZ_H 
  11.  
  12. /*
  13.  * The addresses below are virtual address. The mappings are
  14.  * created on startup via wired entries in the tlb. The Mips
  15.  * Magnum R3000 and R4000 machines are similar in many aspects,
  16.  * but many hardware register are accessible at 0xb9000000 in
  17.  * instead of 0xe0000000.
  18.  */
  19.  
  20. #define JAZZ_LOCAL_IO_SPACE     0xe0000000
  21.  
  22. /*
  23.  * Revision numbers in PICA_ASIC_REVISION
  24.  *
  25.  * 0xf0000000 - Rev1
  26.  * 0xf0000001 - Rev2
  27.  * 0xf0000002 - Rev3
  28.  */
  29. #define PICA_ASIC_REVISION      0xe0000008
  30.  
  31. /*
  32.  * The segments of the seven segment LED are mapped
  33.  * to the control bits as follows:
  34.  *
  35.  *         (7)
  36.  *      ---------
  37.  *      |       |
  38.  *  (2) |       | (6)
  39.  *      |  (1)  |
  40.  *      ---------
  41.  *      |       |
  42.  *  (3) |       | (5)
  43.  *      |  (4)  |
  44.  *      --------- . (0)
  45.  */
  46. #define PICA_LED                0xe000f000
  47.  
  48. /*
  49.  * Some characters for the LED control registers
  50.  * The original Mips machines seem to have a LED display
  51.  * with integrated decoder while the Acer machines can
  52.  * control each of the seven segments and the dot independently.
  53.  * It's only a toy, anyway...
  54.  */
  55. #define LED_DOT                 0x01
  56. #define LED_SPACE               0x00
  57. #define LED_0                   0xfc
  58. #define LED_1                   0x60
  59. #define LED_2                   0xda
  60. #define LED_3                   0xf2
  61. #define LED_4                   0x66
  62. #define LED_5                   0xb6
  63. #define LED_6                   0xbe
  64. #define LED_7                   0xe0
  65. #define LED_8                   0xfe
  66. #define LED_9                   0xf6
  67. #define LED_A                   0xee
  68. #define LED_b                   0x3e
  69. #define LED_C                   0x9c
  70. #define LED_d                   0x7a
  71. #define LED_E                   0x9e
  72. #define LED_F                   0x8e
  73.  
  74. #ifndef _LANGUAGE_ASSEMBLY
  75.  
  76. extern __inline__ void pica_set_led(unsigned int bits)
  77. {
  78.     volatile unsigned int *led_register = (unsigned int *) PICA_LED;
  79.  
  80.     *led_register = bits;
  81. }
  82.  
  83. #endif
  84.  
  85. /*
  86.  * Base address of the Sonic Ethernet adapter in Jazz machines.
  87.  */
  88. #define JAZZ_ETHERNET_BASE  0xe0001000
  89.  
  90. /*
  91.  * Base address of the 53C94 SCSI hostadapter in Jazz machines.
  92.  */
  93. #define JAZZ_SCSI_BASE        0xe0002000
  94.  
  95. /*
  96.  * i8042 keyboard controller for JAZZ and PICA chipsets.
  97.  * This address is just a guess and seems to differ from
  98.  * other mips machines such as RC3xxx...
  99.  */
  100. #define JAZZ_KEYBOARD_ADDRESS   0xe0005000
  101. #define JAZZ_KEYBOARD_DATA      0xe0005000
  102. #define JAZZ_KEYBOARD_COMMAND   0xe0005001
  103.  
  104. #ifndef _LANGUAGE_ASSEMBLY
  105.  
  106. typedef struct {
  107.     unsigned char data;
  108.     unsigned char command;
  109. } jazz_keyboard_hardware;
  110.  
  111. typedef struct {
  112.     unsigned char pad0[3];
  113.     unsigned char data;
  114.     unsigned char pad1[3];
  115.     unsigned char command;
  116. } mips_keyboard_hardware;
  117.  
  118. /*
  119.  * For now. Needs to be changed for RC3xxx support. See below.
  120.  */
  121. #define keyboard_hardware       jazz_keyboard_hardware
  122.  
  123. #endif
  124.  
  125. /*
  126.  * i8042 keyboard controller for most other Mips machines.
  127.  */
  128. #define MIPS_KEYBOARD_ADDRESS   0xb9005000
  129. #define MIPS_KEYBOARD_DATA      0xb9005003
  130. #define MIPS_KEYBOARD_COMMAND   0xb9005007
  131.  
  132. /*
  133.  * Serial and parallel ports (WD 16C552) on the Mips JAZZ
  134.  */
  135. #define JAZZ_SERIAL1_BASE       (unsigned int)0xe0006000
  136. #define JAZZ_SERIAL2_BASE       (unsigned int)0xe0007000
  137. #define JAZZ_PARALLEL_BASE      (unsigned int)0xe0008000
  138.  
  139. /*
  140.  * Dummy Device Address. Used in jazzdma.c
  141.  */
  142. #define JAZZ_DUMMY_DEVICE       0xe000d000
  143.      
  144. /*
  145.  * JAZZ timer registers and interrupt no.
  146.  * Note that the hardware timer interrupt is actually on
  147.  * cpu level 6, but to keep compatibility with PC stuff
  148.  * it is remapped to vector 0. See arch/mips/kernel/entry.S.
  149.  */
  150. #define JAZZ_TIMER_INTERVAL     0xe0000228
  151. #define JAZZ_TIMER_REGISTER     0xe0000230
  152.  
  153. /*
  154.  * DRAM configuration register
  155.  */
  156. #ifndef _LANGUAGE_ASSEMBLY
  157. #ifdef __MIPSEL__
  158. typedef struct {
  159.     unsigned int bank2 : 3;
  160.     unsigned int bank1 : 3;
  161.     unsigned int mem_bus_width : 1;
  162.     unsigned int reserved2 : 1;
  163.     unsigned int page_mode : 1;
  164.     unsigned int reserved1 : 23;
  165. } dram_configuration;
  166. #else /* defined (__MIPSEB__) */
  167. typedef struct {
  168.     unsigned int reserved1 : 23;
  169.     unsigned int page_mode : 1;
  170.     unsigned int reserved2 : 1;
  171.     unsigned int mem_bus_width : 1;
  172.     unsigned int bank1 : 3;
  173.     unsigned int bank2 : 3;
  174. } dram_configuration;
  175. #endif
  176. #endif /* _LANGUAGE_ASSEMBLY */
  177.  
  178. #define PICA_DRAM_CONFIG        0xe00fffe0
  179.  
  180. /*
  181.  * JAZZ interrupt control registers
  182.  */
  183. #define JAZZ_IO_IRQ_SOURCE      0xe0010000
  184. #define JAZZ_IO_IRQ_ENABLE      0xe0010002
  185.  
  186. /*
  187.  * JAZZ interrupt enable bits
  188.  */
  189. #define JAZZ_IE_PARALLEL            (1 << 0)
  190. #define JAZZ_IE_FLOPPY              (1 << 1)
  191. #define JAZZ_IE_SOUND               (1 << 2)
  192. #define JAZZ_IE_VIDEO               (1 << 3)
  193. #define JAZZ_IE_ETHERNET            (1 << 4)
  194. #define JAZZ_IE_SCSI                (1 << 5)
  195. #define JAZZ_IE_KEYBOARD            (1 << 6)
  196. #define JAZZ_IE_MOUSE               (1 << 7)
  197. #define JAZZ_IE_SERIAL1             (1 << 8)
  198. #define JAZZ_IE_SERIAL2             (1 << 9)
  199.  
  200. /*
  201.  * JAZZ Interrupt Level definitions
  202.  *
  203.  * This is somewhat broken.  For reasons which nobody can remember anymore
  204.  * we remap the Jazz interrupts to the usual ISA style interrupt numbers.
  205.  */
  206. #define JAZZ_TIMER_IRQ          0
  207. #define JAZZ_KEYBOARD_IRQ       1
  208. #define JAZZ_FLOPPY_IRQ         6 /* needs to be consistent with floppy driver! */
  209. #define JAZZ_SCSI_IRQ           16
  210. #define JAZZ_ETHERNET_IRQ       17
  211. #define JAZZ_SERIAL1_IRQ        18
  212. #define JAZZ_SERIAL2_IRQ        19
  213. #define JAZZ_PARALLEL_IRQ       20
  214. #define JAZZ_MOUSE_IRQ          21
  215.  
  216. /*
  217.  * JAZZ DMA Channels
  218.  * Note: Channels 4...7 are not used with respect to the Acer PICA-61
  219.  * chipset which does not provide these DMA channels.
  220.  */
  221. #define JAZZ_SCSI_DMA           0              /* SCSI */
  222. #define JAZZ_FLOPPY_DMA         1              /* FLOPPY */
  223. #define JAZZ_AUDIOL_DMA         2              /* AUDIO L */
  224. #define JAZZ_AUDIOR_DMA         3              /* AUDIO R */
  225.  
  226. /*
  227.  * JAZZ R4030 MCT_ADR chip (DMA controller)
  228.  * Note: Virtual Addresses !
  229.  */
  230. #define JAZZ_R4030_CONFIG    0xE0000000    /* R4030 config register */
  231. #define JAZZ_R4030_REVISION     0xE0000008    /* same as PICA_ASIC_REVISION */
  232. #define JAZZ_R4030_INV_ADDR    0xE0000010    /* Invalid Address register */
  233.  
  234. #define JAZZ_R4030_TRSTBL_BASE  0xE0000018    /* Translation Table Base */
  235. #define JAZZ_R4030_TRSTBL_LIM   0xE0000020    /* Translation Table Limit */
  236. #define JAZZ_R4030_TRSTBL_INV   0xE0000028    /* Translation Table Invalidate */
  237.  
  238. #define JAZZ_R4030_CACHE_MTNC   0xE0000030    /* Cache Maintenance */
  239. #define JAZZ_R4030_R_FAIL_ADDR  0xE0000038    /* Remote Failed Address */
  240. #define JAZZ_R4030_M_FAIL_ADDR  0xE0000040    /* Memory Failed Address */
  241.  
  242. #define JAZZ_R4030_CACHE_PTAG   0xE0000048    /* I/O Cache Physical Tag */
  243. #define JAZZ_R4030_CACHE_LTAG   0xE0000050    /* I/O Cache Logical Tag */
  244. #define JAZZ_R4030_CACHE_BMASK  0xE0000058    /* I/O Cache Byte Mask */
  245. #define JAZZ_R4030_CACHE_BWIN   0xE0000060    /* I/O Cache Buffer Window */
  246.  
  247. /*
  248.  * Remote Speed Registers. 
  249.  *
  250.  *  0: free,      1: Ethernet,  2: SCSI,      3: Floppy,
  251.  *  4: RTC,       5: Kb./Mouse  6: serial 1,  7: serial 2,
  252.  *  8: parallel,  9: NVRAM,    10: CPU,      11: PROM,
  253.  * 12: reserved, 13: free,     14: 7seg LED, 15: ???
  254.  */
  255. #define JAZZ_R4030_REM_SPEED    0xE0000070    /* 16 Remote Speed Registers */
  256.                         /* 0xE0000070,78,80... 0xE00000E8 */
  257. #define JAZZ_R4030_IRQ_ENABLE   0xE00000E8    /* Internal Interrupt Enable */
  258. #define JAZZ_R4030_INVAL_ADDR   0xE0000010    /* Invalid address Register */
  259. #define JAZZ_R4030_IRQ_SOURCE   0xE0000200    /* Interrupt Source Register */
  260. #define JAZZ_R4030_I386_ERROR   0xE0000208    /* i386/EISA Bus Error */
  261.  
  262. /*
  263.  * Virtual (E)ISA controller address
  264.  */
  265. #define JAZZ_EISA_IRQ_ACK    0xE0000238    /* EISA interrupt acknowledge */
  266.  
  267. /*
  268.  * Access the R4030 DMA and I/O Controller
  269.  */
  270. #ifndef _LANGUAGE_ASSEMBLY
  271.  
  272. extern inline void r4030_delay(void)
  273. {
  274. __asm__ __volatile__(
  275.     ".set\tnoreorder\n\t"
  276.     "nop\n\t"
  277.     "nop\n\t"
  278.     "nop\n\t"
  279.     "nop\n\t"
  280.     ".set\treorder");
  281. }
  282.  
  283. extern inline unsigned short r4030_read_reg16(unsigned addr)
  284. {
  285.     unsigned short ret = *((volatile unsigned short *)addr);
  286.     r4030_delay();
  287.     return ret;
  288. }
  289.  
  290. extern inline unsigned int r4030_read_reg32(unsigned addr)
  291. {
  292.     unsigned int ret = *((volatile unsigned int *)addr);
  293.     r4030_delay();
  294.     return ret;
  295. }
  296.  
  297. extern inline void r4030_write_reg16(unsigned addr, unsigned val)
  298. {
  299.     *((volatile unsigned short *)addr) = val;
  300.     r4030_delay();
  301. }
  302.  
  303. extern inline void r4030_write_reg32(unsigned addr, unsigned val)
  304. {
  305.     *((volatile unsigned int *)addr) = val;
  306.     r4030_delay();
  307. }
  308.  
  309. #endif /* !LANGUAGE_ASSEMBLY__ */
  310.  
  311. #define JAZZ_FDC_BASE    0xe0003000
  312. #define JAZZ_RTC_BASE    0xe0004000
  313. #define JAZZ_PORT_BASE    0xe2000000
  314.  
  315. #define JAZZ_EISA_BASE    0xe3000000
  316.  
  317. #endif /* __ASM_MIPS_JAZZ_H */
  318.